// Vue过滤器
import { useDict } from "@/utils/dict"
import { formatDigit, formatNumberWithUnit } from "@/utils/format"
import { formatDistance } from "@/utils/map"
import { floorToDecimalPlaces } from "@/utils/utils"
import { formatDate, formatUnixDate, formatTime, aroundDate, formatPastTime, formatDayWeekDesc, formatWeekDesc, formatShowYearDate, splitDate } from "@/utils/date"
import { encryptMobile } from "@/utils/hook"
const filters = {
  useDict: (value, dictName, options) => useDict(dictName, value, options),
  floorToDecimalPlaces,
  formatDate, // 格式化日期
  formatUnixDate,
  formatTime, // 格式化时间
  formatDigit, // 格式化金额
  formatNumberWithUnit, // 格式化数字
  formatWeekDesc, // 格式化周几描述
  formatDayWeekDesc, // 格式化今天明天后天周几描述
  aroundDate,
  formatPastTime,
  formatDistance, // 格式化距离
  formatShowYearDate, // 条件显示格式化时间
  encryptMobile,
  splitDate
}

export default (Vue) => {
  Object.keys(filters).forEach((key) => {
    Vue.filter(key, filters[key])
  })
}
